﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;



namespace VodafoneLiveTile.Connections
{
    public class CheckDataConnection : BasicConnection
    {
        

        public CheckDataConnection(VodafoneResult result, string username, string password, string number, bool isFirstNumber, Action<HttpWebResponse> basicConnectionCallBack, Action onConnectionError, Action<HttpWebResponse> onCompletion)
        :base(result, username, password, number, isFirstNumber, basicConnectionCallBack, onConnectionError, null)
        {
            connections.AddConnection(new ConnectionGET()
            {
                url = "https://www.areaprivati.vodafone.it/190/fads/Infoattivazione.do?ls=1&channelId=-8642&programId=10849&ty_key=ifor_ind_servass&pageTypeId=9604&ty_nocache=true",
                CookieContainer = cookieJar,
                prevProcessor = (_) => { },
                currProcessor = (response)=>{
                    if (basicConnectionCallBack != null)
                        basicConnectionCallBack(response);
                    if (onCompletion != null)
                        onCompletion(response);
                },
                onError = OnConnectionError
            });
        }
    }
}
